<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        #div0{
            width: 100%;
        }
        #div0 div{
            float: left;
            height: 100px;
        }
        /* 1行三个div */
        @media screen and (min-device-width: 400px) {
            #div0 div{
                width: 33.3%;
            }
            #div0 div:nth-child(1){
                background-color: red;
            }
            #div0 div:nth-child(2){
                background-color: blue;
            }
            #div0 div:nth-child(3){
                background-color: green;
            }
        }
        /* 2行三个div */
        @media screen and (min-device-width: 300px) and (max-device-width: 399px) {
            #div0 div{
                width: 50%;
            }
            #div0 div:nth-child(1){
                background-color: red;
            }
            #div0 div:nth-child(2){
                background-color: blue;
            }
            #div0 div:nth-child(3){
                background-color: green;
            }
        }
        /* 3行三个div */
        @media screen and  (max-device-width: 299px) {
            #div0 div{
                width: 100%;
            }
            #div0 div:nth-child(1){
                background-color: red;
            }
            #div0 div:nth-child(2){
                background-color: blue;
            }
            #div0 div:nth-child(3){
                background-color: green;
            }
        }
    </style>
</head>
<body>
    <div id="div0">
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
</html>
